package com.lyc.lojbackendquestionservice.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lyc.lojbackendmodel.model.dto.question.QuestionQueryRequest;
import com.lyc.lojbackendmodel.model.entity.Question;
import com.lyc.lojbackendmodel.model.entity.QuestionSubmit;
import com.lyc.lojbackendmodel.model.entity.User;
import com.lyc.lojbackendmodel.model.vo.QuestionManageVO;
import com.lyc.lojbackendmodel.model.vo.QuestionSubmitVO;
import com.lyc.lojbackendmodel.model.vo.QuestionVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author Linyichengzi
 * @description 针对表【question(题目)】的数据库操作Service
 * @createDate 2023-08-10 10:28:01
 */
public interface QuestionService extends IService<Question> {
    /**
     * 题目推荐
     * @param questionId
     * @return
     */
    List<QuestionVO> getRecommend(Long questionId, HttpServletRequest request);

    /**
     * 校验
     *
     * @param question
     * @param add
     */
    void validQuestion(Question question, boolean add);

    /**
     * 获取查询条件
     *
     * @param questionQueryRequest
     * @return
     */
    QueryWrapper<Question> getQueryWrapper(QuestionQueryRequest questionQueryRequest, HttpServletRequest request);

    /**
     * 获取题目封装
     *
     * @param question
     * @param request
     * @return
     */
    QuestionVO getQuestionVO(Question question, HttpServletRequest request);

    /**
     * 分页获取题目封装
     *
     * @param questionPage
     * @param request
     * @return
     */
    Page<QuestionVO> getQuestionVOPage(Page<Question> questionPage, HttpServletRequest request);

    /**
     * 管理题目列表页面
     *
     * @param questionPage   题目分页
     * @param queryWrapper 查询条件
     * @return {@link Page}<{@link QuestionManageVO}>
     */
//    Page<QuestionManageVO> listManageQuestionByPage(Page<Question> questionPage, QueryWrapper<Question> queryWrapper);
    
    /**
     * 获取题目管理封装
     *
     * @param question
     * @param loginUser
     * @return
     */
    QuestionManageVO getQuestionManagerVO(Question question, User loginUser);
    
    Page<QuestionManageVO> getQuestionManageVOPage(Page<Question> questionPage, User loginUser);
    
}
